<%@ page import="java.util.Arrays" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/12/24 0024
  Time: 20:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.*"%>
<%
    request.setCharacterEncoding("utf-8");
%>
<html>
<head>
    <title>判断用户名是否重名</title>
</head>
<body>

<%

    String names[]={"黄彪","admin","member"};

    String name=request.getParameter("event");

        Arrays.sort(names);
        int judge=Arrays.binarySearch(names,name);//二分法查询数组内是否有此值

        if(judge>-1){
            out.print("很抱歉!该用户名已经被删除");
        }else{
            out.print("恭喜您!该用户名没有被注册过");
        }



%>

</body>
</html>
